var myvue = new Vue({
	el: "body",
	data: {
		numa: "",
		numb: "",
		numc: "",
		searchdiv: "",
		load: true,
		top: ""
	},
	methods: {
		aaa: function() {
			console.log(this.num);
		},
		tiaozhuan: function(e) {
			console.log("进入跳转");
			//不登录无法浏览此页面
			var curr = AV.User.current();
			if(curr) {
				console.log("欢迎" + curr.attributes.username + "的光临");
				location.href = "page2/xinxia.html?id=" + e;
			} else {
				console.log("未登录");
				location.href = "init/init.html";
			};
		},
		tiaozhuanb: function(e) {
			//不登录无法浏览此页面
			var curr = AV.User.current();
			if(curr) {
				console.log("欢迎" + curr.attributes.username + "的光临");
				location.href = "../page2/xinxib.html?id=" + e;
			} else {
				console.log("未登录");
				location.href = "../init/init.html";
			};
		},
		search: function() {
			if(this.searchdiv.indexOf("摄影") >= 0) {
				location.href = "page2/page2.html";
				console.log(1);
				console.log(this.searchdiv);
			} else if(this.searchdiv.indexOf("司仪") >= 0) {
				location.href = "page2/page2b.html";
				console.log(2)

			} else if(this.searchdiv.indexOf("酒店") >= 0) {
				location.href = "page2/page2c.html";
				console.log(3)

			} else {
				console.log(4);
				$("#my-alert").modal('open');
			}
		}
	},
	created: function() {
		init();
	}
})

function init() {
	var APP_ID = 'Wx3JTgmqBaARoWCaGI96AM9h-gzGzoHsz';
	var APP_KEY = 'TrVpB16Og6Yac9u3BoiUy4hT';
	AV.init({
		appId: APP_ID,
		appKey: APP_KEY
	});
	//不登录无法浏览此页面
	var curr = AV.User.current();
	if(curr) {
		console.log("欢迎" + curr.attributes.username + "的光临");
	} else {
		console.log("未登录");
	};
	var query = new AV.Query('otherUser');
	query.contains('class', '1');
	query.find().then(function(x) {
		myvue.numa = x;
		console.log(myvue.numa);
	});
	var queryb = new AV.Query('otherUser');
	queryb.contains('class', '2');
	queryb.find().then(function(x) {
		myvue.numb = x;
		console.log(myvue.numb);
	});
	var queryc = new AV.Query('hotel');
	queryc.find().then(function(x) {
		myvue.numc = x;
		console.log(myvue.numc);
		myvue.load = false;
	});
}